package vn.com.ltv.lo.common;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Validate  {
	// VALIDATE EMAIL METHOD
		public static boolean validateEmail(String email) {
			Pattern pattern;
			Matcher matcher;
			String EMAIL_PATTERN = 
	          "[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" +
	          "\\@" +
	          "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" +
	          "(" +
	          "\\." +
	          "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" +
	          ")+";
			pattern = Pattern.compile(EMAIL_PATTERN);
			matcher = pattern.matcher(email);
			return matcher.matches();
			}
		//VALIDATE PASSWORD METHOD
		public static boolean validatePassword(String pass) {
			Pattern pattern;
			Matcher matcher;
			String EMAIL_PATTERN ="^[^ ]{6,}$";
			pattern = Pattern.compile(EMAIL_PATTERN);
			matcher = pattern.matcher(pass);
			return matcher.matches();
			}
}
